package org.rvk.vms.dal.model.search;

import java.io.Serializable;
import java.util.List;

/**
 * Generic search result.
 *
 * @author Ashish Kumar Sinha <aksinha.mail@gmail.com>
 */
public class SearchResult<T> implements IPageable, Serializable {

    private final SearchInput searchInput;
    private final List<T> result;

    private final long total;

    public SearchResult(SearchInput searchInput, List<T> result, long total) {
        this.searchInput = searchInput;
        this.result = result;
        this.total = total;
    }

    public List<T> getResult() {
        return result;
    }

    /**
     * to get the current page number
     *
     * @return - current page number
     */
    @Override
    public int getPage() {
        return searchInput.getPage();
    }

    /**
     * to get the total number of records available with the
     *
     * @return - the total number of records
     */
    @Override
    public long getTotal() {
        return total;
    }

    /**
     * to get the current page size specified in the SearchInput.
     *
     * @return - the page size specified in the search input.
     */
    @Override
    public int getPageSize() {
        return searchInput.getPageSize();
    }


}
